<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 求数字n的阶乘
    var n = parseInt(prompt('请输入一个数', '5'));
    var mul = 1;
    for (var i = 1; i <= n; i++) {
      mul *= i;
    }
    //                    5              120
    alert('您输入的数是' + n + ',阶乘是' + mul);
  </script>
</body>

</html>